#include<stdio.h>
int main()
{
	int a,b=8;
	char c;
	scanf("%d %c",&a,&c);
	b=c=='y'?b+5:b+0;
	a=a>1000?ceil((a-1000)/500.0):0;
	printf("%d",b+a*4);
    return 0;
}

